"""
This template is written by @the-unknown

What does this quickstart script aim to do?
- This is my template which includes the new QS system.
  It includes a randomizer for my hashtags... with every run, it selects 10 random hashtags from the list.

NOTES:
- I am using the bot headless on my vServer and proxy into a Raspberry PI I have at home, to always use my home IP to connect to Instagram.
  In my comments, I always ask for feedback, use more than 4 words and always have emojis.
  My comments work very well, as I get a lot of feedback to my posts and profile visits since I use this tactic. 

  As I target mainly active accounts, I use two unfollow methods. 
  The first will unfollow everyone who did not follow back within 12h.
  The second one will unfollow the followers within 24h.
"""


#!/usr/bin/python2.7
import random
from instapy import InstaPy
from instapy.util import smart_run



# get a session!
session = InstaPy(username='xxx', password='xxx',  proxy_address='xxx', proxy_port='xxxx', headless_browser=True)


# let's go! :>
with smart_run(session):
    hashtags = ['travelcouples', 'travelcommunity', 'passionpassport', 'travelingcouple',
                'backpackerlife', 'travelguide', 'travelbloggers', 'travelblog','letsgoeverywhere',
                'travelislife','stayandwander', 'beautifuldestinations', 'moodygrams',
                'ourplanetdaily', 'travelyoga', 'travelgram', 'sunsetporn','lonelyplanet',
                'igtravel', 'instapassport', 'travelling', 'instatraveling', 'travelingram',
                'mytravelgram', 'skyporn', 'traveler', 'sunrise','sunsetlovers', 'travelblog',
                'sunset_pics', 'visiting', 'ilovetravel', 'photographyoftheday', 'sunsetphotography',
                'explorenature', 'landscapeporn', 'exploring_shotz', 'landscapehunter', 'colors_of_day',
                'earthfocus', 'ig_shotz', 'ig_nature', 'discoverearth', 'thegreatoutdoors']
    random.shuffle(hashtags)
    my_hashtags = hashtags[:10]

    # general settings
    session.set_dont_like(['sad', 'rain', 'depression'])
    session.set_do_follow(enabled=True, percentage=40, times=1)
    session.set_do_comment(enabled=True, percentage=30)
    session.set_comments([u'What an amazing shot! :heart_eyes: What do you think of my recent shot?',
                          u'What an amazing shot! :heart_eyes: I think you might also like mine. :wink:',
                          u'Wonderful!! :heart_eyes: Would be awesome if you would checkout my photos as well!',
                          u'Wonderful!! :heart_eyes: I would be honored if you would checkout my images and tell me what you think. :wink:',
                          u'This is awesome!! :heart_eyes: Any feedback for my photos? :wink:',
                          u'This is awesome!! :heart_eyes:  maybe you like my photos, too? :wink:',
                          u'I really like the way you captured this. I bet you like my photos, too :wink:',
                          u'I really like the way you captured this. If you have time, check out my photos, too. I bet you will like them. :wink:',
                          u'Great capture!! :smiley: Any feedback for my recent shot? :wink:',
                          u'Great capture!! :smiley: :thumbsup: What do you think of my recent photo?'],
                            media='Photo')
    session.set_do_like(True, percentage=70)
    session.set_delimit_liking(enabled=True, max=100, min=0)
    session.set_delimit_commenting(enabled=True, max=20, min=0)
    session.set_relationship_bounds(enabled=True,
                                     potency_ratio=None,
                                     delimit_by_numbers=True,
                                      max_followers=3000,
                                      max_following=2000,
                                      min_followers=100,
                                      min_following=50)

    session.set_quota_supervisor(enabled=True, sleep_after=["likes", "follows"], sleepyhead=True, stochastic_flow=True, notify_me=True,
                                  peak_likes=(100, 1000),
                                   peak_comments=(21, 250),
                                    peak_follows=(200, None))

    session.set_user_interact(amount=1, randomize=False, percentage=40)
    
    # activity
    session.like_by_tags(my_hashtags, amount=60, media=None)
    session.unfollow_users(amount=500, InstapyFollowed=(True, "nonfollowers"), style="FIFO", unfollow_after=12*60*60, sleep_delay=501)
    session.unfollow_users(amount=500, InstapyFollowed=(True, "all"), style="FIFO", unfollow_after=24*60*60, sleep_delay=501) 



